import { IsString, IsNotEmpty, MinLength, MaxLength } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class RegisterDto {
  @ApiProperty({
    description: '用户账号',
    example: 'admin',
    minLength: 3,
    maxLength: 50,
  })
  @IsString()
  @IsNotEmpty({ message: '账号不能为空' })
  @MinLength(3, { message: '账号长度至少为3个字符' })
  @MaxLength(50, { message: '账号长度不能超过50个字符' })
  username: string;

  @ApiProperty({
    description: '密码',
    example: '123456',
    minLength: 6,
  })
  @IsString()
  @IsNotEmpty({ message: '密码不能为空' })
  @MinLength(6, { message: '密码长度至少为6个字符' })
  password: string;

  @ApiProperty({
    description: '确认密码',
    example: '123456',
  })
  @IsString()
  @IsNotEmpty({ message: '确认密码不能为空' })
  confirmPassword: string;

  @ApiProperty({
    description: '用户姓名',
    example: '管理员',
    maxLength: 50,
  })
  @IsString()
  @IsNotEmpty({ message: '姓名不能为空' })
  @MaxLength(50, { message: '姓名长度不能超过50个字符' })
  name: string;
}
